Interrupt 21h Function 440Dh Minor Code
6Dh
Enumerates
open files on the specified drive.
mov ax, 440Dh ; generic IOCTL
mov bx, DriveNum ; see below
mov ch, 08h ; device category (must be 08h)
mov cl, 6Dh ; Enumerate Open Files
mov dx, seg PathBuf ; see below
mov ds, dx
mov dx, offset PathBuf
mov si, FileIndex ; see below
mov di, EnumType ; see below
int 21h
jc error
mov [OpenMode], ax ; mode file was opened in
mov [FileType], cx ; normal file or memory-mapped file
Parameters
DriveNum
Drive on
which to enumerate the files. This parameter can be 0 for the default drive, 1
for A, 2 for B, and so on.
PathBuf
Address of a
buffer that receives the path of the open file. The length of the buffer varies
depending on the volume. Get Volume Information (Interrupt 21h Function
71A0h
FileIndex
Index of the
file to retrieve the path for.
EnumType
Kind of file
to enumerate. This parameter can be 0 to enumerate all open files or 1 to
enumerate only open unmovable files, including open memory-mapped files and
other open unmovable files (32-bit Windows-based DLLs and executables).
Return Value
Clears the
carry flag, copies the path of an open file to the given buffer, and sets the
AX and CX registers to the following values if successful:
AX |
Mode that
the file was opened in, which is a combination of access mode, sharing mode,
and open flags. It can be one value each from the access and sharing modes
and any combination of open flags. |
|
|
Access
modes |
|
|
OPEN_ACCESS_READONLY
(0000h) |
|
|
OPEN_ACCESS_WRITEONLY
(0001h) |
|
|
OPEN_ACCESS_READWRITE
(0002h) |
|
|
OPEN_ACCESS_RO_NOMODLASTACCESS
(0004h) |
|
|
Share
modes |
|
|
OPEN_SHARE_COMPATIBLE
(0000h) |
|
|
OPEN_SHARE_DENYREADWRITE
(0010h) |
|
|
OPEN_SHARE_DENYWRITE
(0020h) |
|
|
OPEN_SHARE_DENYREAD
(0030h) |
|
|
OPEN_SHARE_DENYNONE
(0040h) |
|
|
Open
flags |
|
|
OPEN_FLAGS_NOINHERIT
(0080h) |
|
|
OPEN_FLAGS_NO_BUFFERING
(0100h) |
|
|
OPEN_FLAGS_NO_COMPRESS
(0200h) |
|
|
OPEN_FLAGS_ALIAS_HINT
(0400h) |
|
|
OPEN_FLAGS_NOCRITERR
(2000h) |
|
|
OPEN_FLAGS_COMMIT
(4000h) |
|
CX |
File type.
It can be one of the following values: |
|
|
0 |
For normal
files |
|
1 |
For a
memory-mapped files (memory-mapped files are unmovable) |
|
2 |
For any
other unmovable files (32-bit Windows-based DLLs and executables) |
|
4 |
For the
swap file |
Note that if
a memory-mapped file is returned (CX = 1), the value returned in the AX
register is limited to the following values:
OPEN_ACCESS_READONLY
(0000h) |
|
OPEN_ACCESS_READWRITE
(0002h) |
|
Otherwise,
the function sets the carry flag and sets the AX register to the following
error value:
ERROR_ACCESS_DENIED |
The value
of FileIndex exceeds the number of open files on the drive. |
Remarks
This function
returns information about one file at a time. To enumerate all open files, the
function must be called repeatedly with FileIndex set to a new value for
each call. FileIndex should be set to zero initially and then
incremented by one for each subsequent call. The function returns the
ERROR_NO_MORE_FILES error value when all open files on the volume have been
enumerated.
This
function may return inconsistent results when used to enumerate files on an
active volume that is,
on a volume where other processes may be opening and closing files. Applications
should use Lock Logical Volume (Interrupt 21h
Function 440Dh Minor Code 4Ah) to take a level 3 lock before enumerating
open files.